package com.xm2.demo.login.admin.service;

import com.xm2.demo.login.admin.dao.AdminRepository;
import com.xm2.demo.model.Position;
import com.xm2.demo.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Create
 * @create 2018-12-20 17:40
 * @Description：
 */
@Service
public class AdminServiceImpl implements AdminService{

    @Autowired
    private AdminRepository adminRepository;

    @Override
    public User findUserByPhone(String username) {
        return adminRepository.findUserByPhone(username);
    }

    @Override
    public Position getStateArr(User user) {
        return adminRepository.getPositionByPid(user.getPositionId());
    }

    @Override
    public void updatePassword(User user) {
        adminRepository.save(user);
    }
}
